import {axiosPost} from "@/libs/http";

function getDayData (date){
    return new Promise((resolve,reject)=>{
        axiosPost({
            url:"/api/calendar/day",
            data:{date},
            success(data){
                resolve(data);
            },
            error(err){
                reject(err);
            }
        })
    })
}

function getMoonData (data){
    return new Promise((resolve,reject)=>{
        axiosPost({
            url:"/api/calendar/month",
            data:{
                "year-month":data
            },
            success(data){
                resolve(data);
            },
            error(err){
                reject(err);
            }
        })
    })
}

function getYearData (data){
    return new Promise((resolve,reject)=>{
        axiosPost({
            url:"/api/calendar/year",
            data:{
                year:data
            },
            success(data){
                resolve(data);
            },
            error(err){
                reject(err);
            }
        })
    })
}

export {
    getDayData,
    getMoonData,
    getYearData
}